#include <functional>

#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include "module_1.hpp"
#include "module_2.hpp"
#include "module_3.hpp"
#include "module_4.hpp"

TEST(Module1Test, func1) {
  EXPECT_EQ(bazel_ns::func1(1), 2);
}

TEST(Module2Test, func2) {
  EXPECT_EQ(bazel_ns::func2(3), 5);
}

TEST(Module3Test, func3) {
  EXPECT_EQ(bazel_ns::func3(5), 8);
}

namespace bazel_ns {

static std::function<bool()> _func4_a;

struct Func4_aMock {
     Func4_aMock() {
         _func4_a = [this](){ return func4_a(); };
     }
     MOCK_METHOD(bool, func4_a, ());
};

bool func4_a()
{
    return _func4_a();
}

}

TEST(Module4Test, func4) {

    bazel_ns::Func4_aMock mock;
    EXPECT_CALL(mock, func4_a())
        .WillRepeatedly(::testing::Return(false));
    EXPECT_EQ(bazel_ns::func4(5), 6);
}
